package org.itfarmer.dao.impl;

import java.util.List;

import org.hibernate.Query;
import org.itfarmer.dao.StaffinfoDAO;
import org.itfarmer.dao.pojo.Staffinfo;

@SuppressWarnings("unchecked")
public class StaffinfoDAOImpl extends BaseDAOImpl<Staffinfo, Integer> implements StaffinfoDAO {

	/*
	 * (non-Javadoc)
	 * @see org.itfarmer.dao.StaffinfoDAO#readByWorkid(java.lang.Integer)
	 */
	public Staffinfo readByWorkid(Integer workid) {
		this.init();
		if (workid == null) {
			return null;
		}
		String queryString = "from Staffinfo where workid=?";
		Query query = session.createQuery(queryString);
		List list = query.setInteger(0, workid).list();
		return list == null || list.size() < 1 ? null : (Staffinfo)list.get(0);
	}

	
}
 